﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class DWGM_Add : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        ////得到登陆者所属支队或大队id
        string DepartmentID = Yipusoft.Account.BLL.User.GetUser(User.Identity.Name).DepartmentID;
        ////得到登陆者名称
        string username = User.Identity.Name;

       // string username = "liuzd";

        string police = string.Empty;
        string unitName = string.Empty;
        string unitType = string.Empty;
        string unitInfo = string.Empty;
        string state = string.Empty;
        string info = string.Empty;
        string counts = string.Empty;//单位总数

        DateTime dtime = DateTime.Now;
        //string DepartmentID = "100300";

        try
        {
            police = Request.Params["police"];
            unitName = Request.Params["unitName"];
            unitType = Request.Params["unittype"];
            unitInfo = Request.Params["unitInfo"];
            state = Request.Params["state"];
            info = Request.Params["info"];
        }
        catch
        {
            Response.Write("错误:参数错误!");
            return;
        }

        try
        {
            string id = System.Guid.NewGuid().ToString();
            string sql = "insert into Performance values('" + id + "','" + username + "','" + police + "','" + unitName + "','" + unitInfo + "','" + state + "','" + info + "','" + dtime + "','" + DepartmentID + "','"+unitType+"')";
            DBCls db = new DBCls();
            if (db.ExcuteSql1_Tran(sql))
            {
                string idd = System.Guid.NewGuid().ToString();
                db.ExcuteSql1("insert into KeyUniCount values ('" + idd + "','" + DepartmentID + "',"+counts+")");
                Response.Write(id);
                return;
            }
        }
        catch 
        {
            Response.Write("错误:参数错误!");
            return;
        }
    }
}
